//Wed Aug 31 00:14:03 CDT 2011
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

class NetworkXOneTimePad {
public:
	int crack(vector <string>, vector <string>);
	string XOR(string a, string b){
		int N = a.size();
		for(int i=0; i<N; i++){
			a[i] = (a[i]==b[i] ? '0':'1');
		}
		return a;
	}
};

int NetworkXOneTimePad::crack(vector <string> plain, vector <string> cipher) {
	set<string> keys;
	
	int N = plain.size();
	for(int i=0; i<N; i++){
		string key = XOR(plain[i], cipher[0]);
		bool flag = true;
		for(int j=1; j<cipher.size() && flag; j++)
			if(find(plain.begin(), plain.end(), XOR(key, cipher[j])) == plain.end())
				flag = false;
		if(flag) 
			keys.insert(key);
	}
	return keys.size();
}


//Powered by [KawigiEdit] 2.0!
